<template>
  <div class="home">
    axios实例化
    如果有多个后端接口返回的超时时长不同等
  </div>
</template>

<script>
import axios from "axios";

export default {
  //axios实例化
  //后端接口地址有多个，并且超时时长不一样
  name: "demo4",
  components: {},
  created() {
    let instance=axios.create({
      baseURL:'http://localhost:8080',
      // 超时时长：
      timeout:1000
    });
    instance.get('/data.json').then(
      res=>{
        console.log(res)
      }
    )
    let axios2=axios.create({
      baseURL:'http://localhost:9090',
      timeout:5000
    })
    axios2.get('/data.json').then(
      res=>{
        console.log(res)
      }
    )

  }
};
</script>
